﻿using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
namespace BPM.Web.Shared.Data;

/// <summary>
/// 定时任务
/// </summary>
public partial class SysTimer : BaseVM
{
    /// <summary>
    /// 主键Id
    /// </summary>
    [DisplayName("业务号")]
    [Required(ErrorMessage = "业务号不能为空")]
    [JsonPropertyName("id")]
    public long Id { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    [DisplayName("创建时间")]
    [JsonPropertyName("createdTime")]
    public System.DateTimeOffset? CreatedTime { get; set; }

    /// <summary>
    /// 更新时间
    /// </summary>
    [DisplayName("更新时间")]
    [JsonPropertyName("updatedTime")]
    public System.DateTimeOffset? UpdatedTime { get; set; }

    /// <summary>
    /// 创建者Id
    /// </summary>
    [DisplayName("创建者Id")]
    [JsonPropertyName("createdUserId")]
    public long? CreatedUserId { get; set; }

    /// <summary>
    /// 创建者名称
    /// </summary>
    [DisplayName("创建者名称")]
    [JsonPropertyName("createdUserName")]
    [StringLength(20)]
    public string? CreatedUserName { get; set; }

    /// <summary>
    /// 修改者Id
    /// </summary>
    [DisplayName("修改者Id")]
    [JsonPropertyName("updatedUserId")]
    public long? UpdatedUserId { get; set; }

    /// <summary>
    /// 修改者名称
    /// </summary>
    [DisplayName("修改者名称")]
    [JsonPropertyName("updatedUserName")]
    [StringLength(20)]
    public string? UpdatedUserName { get; set; }

    /// <summary>
    /// 任务名称
    /// </summary>
    [DisplayName("任务名称")]
    [JsonPropertyName("jobName")]
    [Required(ErrorMessage = "任务名称不能为空")]
    [StringLength(20)]
    public string? JobName { get; set; }

    /// <summary>
    /// 只执行一次
    /// </summary>
    [DisplayName("只执行一次")]
    [JsonPropertyName("doOnce")]
    public bool DoOnce { get; set; }

    /// <summary>
    /// 立即执行（默认等待启动）
    /// </summary>
    [DisplayName("立即执行（默认等待启动）")]
    [JsonPropertyName("startNow")]
    public bool StartNow { get; set; }

    [JsonPropertyName("executeType")]
    public SpareTimeExecuteTypes ExecuteType { get; set; }

    /// <summary>
    /// 执行间隔时间（单位秒）
    /// </summary>
    [DisplayName("执行间隔时间（单位秒）")]
    [JsonPropertyName("interval")]
    public int? Interval { get; set; }

    /// <summary>
    /// Cron表达式
    /// </summary>
    [DisplayName("Cron表达式")]
    [JsonPropertyName("cron")]
    [StringLength(20)]
    public string? Cron { get; set; }

    [JsonPropertyName("timerType")]
    public SpareTimeTypes TimerType { get; set; }

    /// <summary>
    /// 请求url
    /// </summary>
    [DisplayName("请求url")]
    [JsonPropertyName("requestUrl")]
    [StringLength(200)]
    public string? RequestUrl { get; set; }

    /// <summary>
    /// 请求参数（Post，Put请求用）
    /// </summary>
    [DisplayName("请求参数（Post，Put请求用）")]
    [JsonPropertyName("requestParameters")]
    public string? RequestParameters { get; set; }

    /// <summary>
    /// Headers(可以包含如：Authorization授权认证)
    /// <br/>格式：{"Authorization":"userpassword.."}
    /// </summary>
    [DisplayName("请求头")]
    [JsonPropertyName("headers")]
    public string? Headers { get; set; }

    /// <summary>
    /// 请求类型
    /// </summary>
    [DisplayName("请求类型")]
    [JsonPropertyName("requestType")]
    public RequestTypeEnum RequestType { get; set; }

    /// <summary>
    /// 备注
    /// </summary>
    [DisplayName("备注")]
    [JsonPropertyName("remark")]
    [StringLength(100)]
    public string? Remark { get; set; }

}
